feat: added pull-to-refresh on home screen.#1035
Conversation
📝 WalkthroughWalkthroughThe main home page now supports pull-to-refresh on mobile devices through a touch-driven state machine. Downward drag triggers data refresh when a distance threshold is met. User info loading is centralized in a helper function and called during both initial mount and subsequent refresh. A visual indicator provides feedback during the gesture. Touch listeners are registered on mount and cleaned up on destroy. ChangesPull-to-refresh functionality
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
infrastructure/eid-wallet/src/routes/(app)/main/+page.svelte (1)
186-201: 💤 Low valueConsider adding error logging for consistency with other loaders.
The other data loaders (
loadBindingDocuments,loadPersonalIntoStore) wrap their logic in try/catch and log warnings on failure. While the upstream controller getters have internal.catch()handlers that returnundefined, adding a similar pattern here would provide consistent diagnostics.♻️ Optional: Add try/catch for consistency
async function loadUserInfo(): Promise<void> { if (!globalState) return; + try { const [userInfo, fake, vaultData] = await Promise.all([ globalState.userController.user, globalState.userController.isFake, globalState.vaultController.vault, ]); isFake = fake; cachedIsFake = fake; userData = { ...userInfo, isFake: fake }; cachedUserData = userData; if (vaultData?.ename) { ename = vaultData.ename; cachedEname = ename; } + } catch (err) { + console.warn("[main] Failed to load user info:", err); + } }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@infrastructure/eid-wallet/src/routes/`(app)/main/+page.svelte around lines 186 - 201, Wrap the body of loadUserInfo in a try/catch similar to loadBindingDocuments/loadPersonalIntoStore: call the same Promise.all on globalState.userController.user, globalState.userController.isFake, and globalState.vaultController.vault inside a try block, and in the catch log a warning with context (e.g., "loadUserInfo failed" plus the caught error) so failures are diagnosable but don’t throw; preserve the existing assignments to isFake, cachedIsFake, userData, cachedUserData, ename and cachedEname when the Promise.all succeeds.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@infrastructure/eid-wallet/src/routes/`(app)/main/+page.svelte:
- Around line 186-201: Wrap the body of loadUserInfo in a try/catch similar to
loadBindingDocuments/loadPersonalIntoStore: call the same Promise.all on
globalState.userController.user, globalState.userController.isFake, and
globalState.vaultController.vault inside a try block, and in the catch log a
warning with context (e.g., "loadUserInfo failed" plus the caught error) so
failures are diagnosable but don’t throw; preserve the existing assignments to
isFake, cachedIsFake, userData, cachedUserData, ename and cachedEname when the
Promise.all succeeds.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: ccc96f67-54ba-4faf-b58b-724cb3022ea2
📒 Files selected for processing (1)
infrastructure/eid-wallet/src/routes/(app)/main/+page.svelte
Description of change
Added pull-to-refresh on home screen of eid-wallet.
Issue Number
Closes #1028
Type of change
How the change has been tested
Manually.
Change checklist
Summary by CodeRabbit
New Features
Performance Improvements